package com.ilxqx.framework.system.form.update;

import com.ilxqx.framework.system.form.UpdateForm;
import com.ilxqx.framework.system.form.anno.Pk;
import com.ilxqx.framework.system.service.impl.SysMenuServiceImpl;
import com.ilxqx.framework.system.validator.anno.Exists;
import com.ilxqx.framework.system.validator.group.FrameworkGroups;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * 系统菜单更新表单类
 * @author venus
 */
@Data
public class SysMenuUpdateForm implements UpdateForm {

	/**
	 * 菜单主键
	 */
	@Pk
	@NotNull(groups = FrameworkGroups.Modify.class, message = "菜单主键{required}")
	@Positive(groups = FrameworkGroups.Modify.class, message = "菜单主键{positive}")
	private Long menuId;

    /**
	 * 父级菜单主键
	 */
    @NotNull(message = "父级菜单{required}")
	@Exists(message = "父级菜单{notExist}", service = SysMenuServiceImpl.class)
	private Long parentMenuId;

	/**
	 * 菜单标题
	 */
	@NotBlank(message = "标题{required}")
	@Size(max = 16, message = "标题{size}")
	private String title;

	/**
	 * 菜单图标
	 */
	@NotBlank(message = "图标{required}")
	@Size(max = 32, message = "图标{size}")
	private String icon;

	/**
	 * 是否不缓存
	 */
	private Boolean noCache;

    /**
	 * 菜单组件
	 */
    @NotBlank(message = "组件{required}")
	@Size(max = 16, message = "组件{size}")
	private String component;

    /**
	 * 菜单路径
	 */
	@NotBlank(message = "菜单Path{required}")
	@Size(max = 32, message = "菜单Path{size}")
	private String path;

    /**
	 * 重定向路径
	 */
	@Size(max = 32, message = "重定向Path{size}")
	private String redirect;

    /**
	 * 是否隐藏
	 */
	private Boolean hidden;

    /**
	 * 是否一直显示
	 */
	private Boolean alwaysShow;

    /**
	 * 菜单排序
	 */
	@NotNull(message = "排序{required}")
	@Positive(message = "排序{positive}")
	private Integer sequence;

    /**
	 * 菜单备注
	 */
	@Size(max = 256, message = "备注{size}")
	private String remark;

}
